//1.引入仓库基础模块方法
import {createStore} from "vuex"

//2.实例化仓库
let store = createStore({
    state(){
        return {
           name:"吃饭"
        }
    },
    getters:{
        get_name(state){
            return state.name;
        }
    },
    mutations:{
        mutation_name(state,payload){
            state.name = payload;
            // console.log(state.name);
        }
    },
    actions:{
        action_name({commit},name){
            setTimeout(function(){
                commit("mutation_name",name)
            },2000)
        }
    },
    modules:{}
})

//3.暴露
export default store;